<template>
  <el-dialog
    top="30px"
    width="1000px"
    title="项目附件"
    append-to-body
    :close-on-click-modal="false"
    :visible.sync="visible"
    :before-close="beforeClose"
  >
    <attach-detail :project-data="projectData"></attach-detail>
    <attach-upload :tags="uploadTags" :batch-no="relatedId">
      <template slot="header">
        <h3 class="attach-title">附件资料</h3>
        <hr />
      </template>
    </attach-upload>
  </el-dialog>
</template>

<script>
import { projectIsCompany } from '@/bank/views/limit/index'
import { enumPersonalTags, enumCompanyTags, otherTag } from '@/bank/views/limit/attach'

import AttachDetail from '@/bank/views/limit/AttachDetail'
import AttachUpload from '@/bank/components/attach/Upload'

export default {
  components: {
    AttachDetail,
    AttachUpload,
  },
  props: {
    visible: Boolean,
    projectData: {
      type: Object,
      default: () => ({}),
    },
  },
  data() {
    return {}
  },
  computed: {
    isCompany() {
      return projectIsCompany(this.projectData)
    },
    uploadTags() {
      return [...(this.isCompany ? enumCompanyTags : enumPersonalTags), otherTag]
    },
    relatedId() {
      return this.projectData.customer_related_id
    },
  },
  watch: {},
  created() {},
  mounted() {},
  methods: {
    beforeClose() {
      this.$emit('update:visible', false)
    },
  },
}
</script>

<style lang="scss" scoped>
.attach-title {
  font-size: 1.1rem;
  font-weight: bold;
}
</style>
